
import java.awt.Dimension;
import java.awt.Toolkit;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Leng
 */
public class eHOSTs{

    

    // initial works before loading GUI
    private static void initial(){
        // check is that current os is a Mac OS
        // and switchpool.iniMSP.isUnixOS = true if its a macos;
        // we use '/' as the path separator
        env.Parameters.isUnixOS = commons.OS.isMacOS();

        //Toolkit kit = Toolkit.getDefaultToolkit(); //添加标题栏图标
        //Image img = kit.getImage("E:\\Java\\javaproject\\StudentInforManager\\img\\title.gif");

        // load all configure values
        String text = "#eHOST# Reading configure file ...";
        System.out.println(text);
        UserInterface.splashWindow.SplashController.showtext(text);

        config.system.SysConf.loadSystemConfigure();

        // after first configure information loading, set the flag
        env.Parameters.isFirstTimeLoadingConfigureFile = false;

        // set the latest mention id to xml module
        int latest_used_metion_id = env.Parameters.getLatestUsedMentionID();
        AlgorithmNegex.XMLMaker.set_mention_id_startpoint( latest_used_metion_id );
    }

    

    // main method of eHOST project
    public static void main(String[] args) {
        String text = null;

        UserInterface.splashWindow.SplashController.start();


        //UserInterface.splashWindow.SplashControl.start_splashWindow();
        
        try {

            
            text = "#eHOST# Initializing ...";
            System.out.println(text);
            UserInterface.splashWindow.SplashController.showtext(text);

            // read configure file and load values into memory
            initial();

            text = "#eHOST# Launching the main GUI ...";
            System.out.println(text);
            UserInterface.splashWindow.SplashController.showtext(text);

            new Thread(){
                @Override
                public void run(){
                    Dimension winSize = Toolkit.getDefaultToolkit().getScreenSize();

                    // show dialog - main GUI window of eHOST project
                    UserInterface.GUI gui = new UserInterface.GUI();
                   // gui.setLocation((int)(( winSize.width - gui.getWidth())/2),
                   //            (int)((winSize.height - gui.getHeight())/2) );
                    gui.setVisible(true);
                    ResultEditor.LoadingNotes.ShowNotes.setGUIHandler(gui);
                    // show log in green
                    //Logs.ShowLogs.printNotice( "eHOST is online now! @ " + commons.OS.getCurrentDate() );
                    //UserInterface.splashWindow.SplashControl.end_splashWindow();

                }
           }.start();

           

           
        } catch (Exception e) {
                e.printStackTrace();
        }
    }
}
